home *** CD-ROM | disk | FTP | other *** search
/ InterCD 2000 September / september_2000.iso / intercd / root / ^Linux / cdrtools-1.10 / libhfs_iso / hfs.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-26  |  5.7 KB  |  189 lines

  1. /*
  2.  * hfsutils - tools for reading and writing Macintosh HFS volumes
  3.  * Copyright (C) 1996, 1997 Robert Leslie
  4.  *
  5.  * This program is free software; you can redistribute it and/or modify
  6.  * it under the terms of the GNU General Public License as published by
  7.  * the Free Software Foundation; either version 2 of the License, or
  8.  * (at your option) any later version.
  9.  *
  10.  * This program is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  * GNU General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with this program; if not, write to the Free Software
  17.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  */
  19.  
  20. # include <time.h>
  21. # include <standard.h>
  22.  
  23. #ifdef APPLE_HYB
  24. #include "hybrid.h"
  25.  
  26. /* don't need device locking for mkhybrid */
  27. #ifndef NODEVLOCKS
  28. #define NODEVLOCKS
  29. #endif /* NODEVLOCKS */
  30.  
  31. #endif /* APPLE_HYB */
  32.  
  33. # define HFS_BLOCKSZ    512
  34. # define HFS_MAX_FLEN    31
  35. # define HFS_MAX_VLEN    27
  36.  
  37. typedef struct _hfsvol_  hfsvol;
  38. typedef struct _hfsfile_ hfsfile;
  39. typedef struct _hfsdir_  hfsdir;
  40.  
  41. typedef struct {
  42.   char name[HFS_MAX_VLEN + 1];    /* name of volume */
  43.   int flags;            /* volume flags */
  44.   unsigned long totbytes;    /* total bytes on volume */
  45.   unsigned long freebytes;    /* free bytes on volume */
  46.   time_t crdate;        /* volume creation date */
  47.   time_t mddate;        /* last volume modification date */
  48. } hfsvolent;
  49.  
  50. /* taken from v3.2.6 */
  51. typedef struct {
  52.   char name[HFS_MAX_FLEN + 1];    /* catalog name (MacOS Standard Roman) */
  53.   int flags;            /* bit flags */
  54.   unsigned long cnid;        /* catalog node id (CNID) */
  55.   unsigned long parid;        /* CNID of parent directory */
  56.  
  57.   time_t crdate;        /* date of creation */
  58.   time_t mddate;        /* date of last modification */
  59.   time_t bkdate;        /* date of last backup */
  60.  
  61.   short fdflags;        /* Macintosh Finder flags */
  62.  
  63.   struct {
  64.     signed short v;        /* Finder icon vertical coordinate */
  65.     signed short h;        /* horizontal coordinate */
  66.   } fdlocation;
  67.  
  68.   union {
  69.     struct {
  70.       unsigned long dsize;    /* size of data fork */
  71.       unsigned long rsize;    /* size of resource fork */
  72.  
  73.       char type[5];        /* file type code (plus null) */
  74.       char creator[5];        /* file creator code (plus null) */
  75.     } file;
  76.  
  77.     struct {
  78.       unsigned short valence;    /* number of items in directory */
  79.  
  80.       struct {
  81.     signed short top;    /* top edge of folder's rectangle */
  82.     signed short left;    /* left edge */
  83.     signed short bottom;    /* bottom edge */
  84.     signed short right;    /* right edge */
  85.       } rect;
  86.  
  87.       /* mkhybrid extra */
  88.       signed short view;    /* Folder's view */
  89.  
  90.       struct {
  91.     signed short v;        /* Scoll vertical position */
  92.     signed short h;        /* Scoll horizontal position */
  93.       } frscroll;
  94.     } dir;
  95.   } u;
  96. } hfsdirent;
  97.  
  98.  
  99. # define HFS_ISDIR        0x01
  100. # define HFS_ISLOCKED        0x02
  101.  
  102. # define HFS_CNID_ROOTPAR    1
  103. # define HFS_CNID_ROOTDIR    2
  104. # define HFS_CNID_EXT        3
  105. # define HFS_CNID_CAT        4
  106. # define HFS_CNID_BADALLOC    5
  107.  
  108. # define HFS_FNDR_ISONDESK        (1 <<  0)
  109. # define HFS_FNDR_COLOR            0x0e
  110. # define HFS_FNDR_COLORRESERVED        (1 <<  4)
  111. # define HFS_FNDR_REQUIRESSWITCHLAUNCH    (1 <<  5)
  112. # define HFS_FNDR_ISSHARED        (1 <<  6)
  113. # define HFS_FNDR_HASNOINITS        (1 <<  7)
  114. # define HFS_FNDR_HASBEENINITED        (1 <<  8)
  115. # define HFS_FNDR_RESERVED        (1 <<  9)
  116. # define HFS_FNDR_HASCUSTOMICON        (1 << 10)
  117. # define HFS_FNDR_ISSTATIONERY        (1 << 11)
  118. # define HFS_FNDR_NAMELOCKED        (1 << 12)
  119. # define HFS_FNDR_HASBUNDLE        (1 << 13)
  120. # define HFS_FNDR_ISINVISIBLE        (1 << 14)
  121. # define HFS_FNDR_ISALIAS        (1 << 15)
  122.  
  123. extern char *hfs_error;
  124. extern unsigned char hfs_charorder[];
  125.  
  126. #ifdef APPLE_HYB
  127. hfsvol *hfs_mount    __PR((hce_mem *, int, int));
  128. #else
  129. hfsvol *hfs_mount    __PR((char *, int, int));
  130. #endif /* APPLE_HYB */
  131.  
  132. int hfs_flush        __PR((hfsvol *));
  133. void hfs_flushall    __PR((void));
  134. #ifdef APPLE_HYB
  135. int hfs_umount        __PR((hfsvol *, long));
  136. #else
  137. int hfs_umount        __PR((hfsvol *));
  138. #endif /* APPLE_HYB */
  139. void hfs_umountall    __PR((void));
  140. hfsvol *hfs_getvol    __PR((char *));
  141. void hfs_setvol        __PR((hfsvol *));
  142.  
  143. int hfs_vstat        __PR((hfsvol *, hfsvolent *));
  144. #ifdef APPLE_HYB
  145. int hfs_format        __PR((hce_mem *, int, char *));
  146. #else
  147. int hfs_format        __PR((char *, int, char *));
  148. #endif /* APPLE_HYB */
  149.  
  150. int hfs_chdir        __PR((hfsvol *, char *));
  151. long hfs_getcwd        __PR((hfsvol *));
  152. int hfs_setcwd        __PR((hfsvol *, long));
  153. int hfs_dirinfo        __PR((hfsvol *, long *, char *));
  154.  
  155. hfsdir *hfs_opendir    __PR((hfsvol *, char *));
  156. int hfs_readdir        __PR((hfsdir *, hfsdirent *));
  157. int hfs_closedir    __PR((hfsdir *));
  158.  
  159. hfsfile *hfs_open    __PR((hfsvol *, char *));
  160. int hfs_setfork        __PR((hfsfile *, int));
  161. int hfs_getfork        __PR((hfsfile *));
  162. long hfs_read        __PR((hfsfile *, void *, unsigned long));
  163. long hfs_write        __PR((hfsfile *, void *, unsigned long));
  164. int hfs_truncate    __PR((hfsfile *, unsigned long));
  165. long hfs_lseek        __PR((hfsfile *, long, int));
  166. #ifdef APPLE_HYB
  167. int hfs_close        __PR((hfsfile *, long, long));
  168. #else
  169. int hfs_close        __PR((hfsfile *));
  170. #endif /* APPLE_HYB */
  171.  
  172. int hfs_stat        __PR((hfsvol *, char *, hfsdirent *));
  173. int hfs_fstat        __PR((hfsfile *, hfsdirent *));
  174. int hfs_setattr        __PR((hfsvol *, char *, hfsdirent *));
  175. int hfs_fsetattr    __PR((hfsfile *, hfsdirent *));
  176.  
  177. int hfs_mkdir        __PR((hfsvol *, char *));
  178. int hfs_rmdir        __PR((hfsvol *, char *));
  179.  
  180. int hfs_create        __PR((hfsvol *, char *, char *, char *));
  181. int hfs_delete        __PR((hfsvol *, char *));
  182.  
  183. int hfs_rename        __PR((hfsvol *, char *, char *));
  184.  
  185. #ifdef APPLE_HYB
  186. unsigned short hfs_get_drAllocPtr    __PR((hfsfile *));
  187. int hfs_set_drAllocPtr            __PR((hfsfile *, unsigned short, int size));
  188. #endif /* APPLE_HYB */
  189.